package com.chaofan.sell.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
 * @author: Fairy
 * @date: 2021/9/18
 */
public class JsonUtil {

    /**
     * Object2Json
     *
     * @param object 需要系列化的对象
     * @return 序列化的结果
     */
    public static String toJson(Object object) {
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setPrettyPrinting();
        Gson gson = gsonBuilder.create();
        return gson.toJson(object);
    }
}
